{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<div class="hry-content-wrapper">
    <section class="content-header">
        <ol class="breadcrumb">
            <li>财务管理</li>
            <li class="active" onclick="goBackPage('memberUrl')">会员对账</li>
            <li class="active">分账明细</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="hry-form-wrapper">
                    <div class="box-header with-border" style="height:55px;">
                        <div class="box-tools" style="top:10px;">
                            <form class="form-inline" id="project—form" action="{:url('Money/moneySubAccount')}" method="GET" pjax-search="" >
                                <input type='hidden' value = '{$user.id}' name = 'id'>
                                <div class="form-group">
                                    <label for="start_date">开始时间</label>
                                    <input class="form-control timepicker" autocomplete="off" id="start_date" name="start_date"
                                           value="{:input('post.start_date')}" placeholder="{$Think.lang.start_date}">
                                </div>
                                <div class="form-group">
                                    <label for="end_date">结束时间</label>
                                    <input class="form-control timepicker" autocomplete="off" id="end_date" name="end_date"
                                           value="{:input('post.end_date')}" placeholder="{$Think.lang.end_date}">
                                </div>
                                <div class="form-group">
                                    <label for="project">所属项目</label>
                                    <select class="form-control" name="project_id" id="project" style="border-radius:3px;width:150px;">
                                        <option value="0">全部</option>
                                        {volist name="project" id="vo"}
                                        <option value="{$vo.id}" {if condition=" $user.project_id eq $vo.id "}selected="selected"{/if} >{$vo.project_name}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="form-group">
                                    <input type="submit" class="btn btn-primary " value="搜索">
                                    <button type="button" id="dwonload" class="btn btn-primary">下载</button>
                                    <button type="button" class="btn btn-primary" onclick="resetForm()">重置</button>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="box-body table-responsive">
                        <table class="table table-bordered table-hover table-sort">
                            <tr>
                                <th>ID{:table_sort('id')}</th>
                                <th>姓名</th>
                                <th>手机号码</th>
                                <th>分账金额{:table_sort('money')}</th>
                                <th>所属项目</th>
                                <th>创建时间{:table_sort('create_time')}</th>
                            </tr>
                            {volist name="dataList" id="v"}
                            <tr>
                                <td>{$v.id}</td>
                                <td>{$v.username}</td>
                                <td>{$v.mobile}</td>
                                <td>{$v.money}</td>
                                <td>{$v.project_name}</td>
                                <td>{$v.create_time}</td>
                            </tr>
                            {/volist}
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        {$dataList->render()}
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<style>
    .member-label {
        text-align: center;
        margin: 20px 0;
        color: red;
    }

    .member-Info {
        text-align: center;
        margin: 20px 0;
    }

    .member-Info span {
        color: orange;
    }
</style>
<script type="text/javascript">
            $(function () {
            $('#dwonload').click(function () {
            var url = "{:url('Money/moneySubAccount')}";
                    var project_id = $("select[name='project_id']").val();
                    var start_date = $("input[name='start_date']").val();
                    var end_date = $("input[name='end_date']").val();
                    var id = $("input[name='id']").val();
                    location.href = url + "?project_id=" + project_id + "&start_date=" + start_date + "&end_date=" + end_date + "&id=" + id + "&down=1";
            });
                    let start_date = $('#start_date').datetimepicker({
            format: 'YYYY-MM-DD',
                    locale: moment.locale('zh-cn')
            });
                    let end_date = $('#end_date').datetimepicker({
            format: 'YYYY-MM-DD',
                    locale: moment.locale('zh-cn')
            });
                    //动态设置最小值
                    start_date.on('dp.change', function (e) {
                    end_date.data('DateTimePicker').minDate(e.date);
                    });
                    //动态设置最大值
                    end_date.on('dp.change', function (e) {
                    start_date.data('DateTimePicker').maxDate(e.date);
                    });
            })

            function resetForm() {
            $('select[name="project_id"]').val('0')
                    $('input[name="start_date"]').val('')
                    $('input[name="end_date"]').val('')
                    $('#project—form').submit()
            }

    $(function () {
    {if condition = " $rest_login == 1 "}
    restlogin('{$rest_login_info}'); //登录超时
    {/if}
    })
</script>
{/block}